/* eslint-disable no-unused-vars */
import geo from './geo'
import home from './home'
export const actions = {
  async nuxtServerInit ({
    commit
  }, {
    req,
    app
  }) {
    const {
      status,
      data: {
        province,
        city
      }
    } = await app.$axios.get('/geo/getPosition')
    commit('geo/setPosition', status === 200 ? {
      province,
      city
    } : {
      province: '',
      city: ''
    })
    const {
      status: status2,
      data: {
        menu
      }
    } = await app.$axios.get('/geo/getMenu')
    commit('home/setMenu', status2 === 200 ? menu : [])
    // // 获取热门搜索
    // const {
    //   status: status3,
    //   data: {
    //     result
    //   }
    // } = await app.$axios.get('/search/getHotPlace', {
    //   params: {
    //     city: app.store.state.geo.position.city.replace('市', '')
    //   }
    // })
    // commit('home/setHotPlace', status3 === 200 ? result : [])
    // // eslint-disable-next-line no-console
    // console.log(app.store.state.geo.position.city)
  }
}
